import { PORT2 } from '@/api/config/servicePort';
import http from '@/api';
import { PublicParams } from '@/api/interface/publicParams';
import { InterfaceFile } from '@/api/interface/basic/file';

/**
 * @name 文件上传
 */

/** 文件上传 */
export const fileUploadFile = (params: InterfaceFile.ReqUploadFile) => {
  return http.post(PORT2 + `/file/v1/uploadFile`, params);
};

/** 文件预览 */
export const filePreview = (params: PublicParams.ReqId) => {
  return http.getDownload(PORT2 + `/file/v1/preview/${params.id}`);
};

/** 文件列表查询 */
export const fileList = (params: InterfaceFile.ReqFileList) => {
  return http.get<InterfaceFile.ResFileList[]>(PORT2 + `/file/v1/list`, params);
};

/** 文件删除 */
export const fileDelete = (params: PublicParams.ReqId) => {
  return http.get(PORT2 + `/file/v1/delete/${params.id}`, params);
};
